package com.tong.dao;

import com.tong.pojo.Books;
import com.tong.pojo.Users;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
   //查询全部User,返回list集合
   @Select("SELECT user.username,permissions.name FROM ssmbuild.user user INNER JOIN ssmbuild.permissions permissions WHERE user.rights = permissions.id;")
   @Results(id = "userQueryAllUser",value = {
           @Result(column = "name",property = "rights")
   })
   List<Users> queryAllUser();

   //根据id删除一个Book
   @Delete("delete from ssmbuild.user where username = #{username}")
   int deleteUser(String username);

   //添加User
   @Insert("INSERT INTO user VALUES(0,#{username},#{password},#{rights})")
   int addUser(Users users);
}